﻿namespace ACCOUNTING.LVY.Business
{
    using ACCOUNTING;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Data;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    public class clsSuaChuaThietBi
    {
        private int mConHanBaoHanh = 0;
        private string mDienGiai = "";
        private string mDienGiaiTraHang = "";
        private string mDienThoaiDiDong = "";
        private string mDienThoaiLienHe = "";
        private string mFaxLienHe = "";
        private string mGioTiepNhan = "";
        private string mGioTraHang = "";
        private string mKhoa = "";
        private string mKhoaDoiTuong = "";
        private string mKhoaHangHoa = "";
        private string mKhoaNhanVienBanHang = "";
        private string mKhoaNhanVienKiemTra = "";
        private string mKhoaNhanVienTiepNhan = "";
        private string mKhoaPhieuXuat = "";
        private int mLoaiSuaChua = 0;
        private string mLoaiTien = "";
        private string mNgayBan = "";
        private string mNgayBanGiaoSales = "";
        private string mNgayChungTu = "";
        private string mNgayHoanTatSuaChua = "";
        private string mNgayKiemTra = "";
        private string mNgayTiepNhan = "";
        private string mNgayTraHang = "";
        private string mNguoiLienHe = "";
        private string mNguyenNhan = "";
        private string mSoChungTu = "";
        private string mSoPhieuXuat = "";
        private string mSoSerial = "";
        private string mThoiHanBaoHanh = "";
        private string mTinhTrangSauKhiSuaChua = "";
        private int mTinhTrangSuaChua = 0;
        private string mTinhTrangThietBi = "";
        private int mTrangThai = 0;
        private double mTriGiaNhanCong = 0.0;
        private double mTriGiaThietBiThayThe = 0.0;
        private double mTyGia = 0.0;
        private string mXacDinhLoi = "";

        public bool BanGiaoThietBi(string strTask)
        {
            bool flag=false;
            IDataParameter[] commandParameters = new IDataParameter[10];
            try
            {
                commandParameters[0] = DBHelper.createParameter("@Khoa", DbType.Int64, ParameterDirection.Input, this.mKhoa);
                commandParameters[1] = DBHelper.createParameter("@TinhTrangSuaChua", DbType.Double, ParameterDirection.Input, this.mTinhTrangSuaChua);
                commandParameters[2] = DBHelper.createParameter("@NgayHoanTatSuaChua", DbType.Int64, ParameterDirection.Input, this.mNgayHoanTatSuaChua);
                commandParameters[3] = DBHelper.createParameter("@TinhTrangSauKhiSuaChua", DbType.Int64, ParameterDirection.Input, this.mTinhTrangSauKhiSuaChua);
                commandParameters[4] = DBHelper.createParameter("@NgayBanGiaoSales", DbType.Int64, ParameterDirection.Input, this.mNgayBanGiaoSales);
                commandParameters[5] = DBHelper.createParameter("@NgayTraHang", DbType.Int64, ParameterDirection.Input, this.mNgayTraHang);
                commandParameters[6] = DBHelper.createParameter("@GioTraHang", DbType.Int64, ParameterDirection.Input, this.mGioTraHang);
                commandParameters[7] = DBHelper.createParameter("@DienGiaiTraHang", DbType.Int64, ParameterDirection.Input, this.mDienGiaiTraHang);
                commandParameters[8] = DBHelper.createParameter("@Task", DbType.Int64, ParameterDirection.Input, strTask);
                commandParameters[9] = DBHelper.createParameter("@pError", DbType.Double, ParameterDirection.Output, 0);
                int num = DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.StoredProcedure, "SC_sp_BanGiaoThietBi", commandParameters);
                if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(commandParameters[9].Value, 0, false))
                {
                    return true;
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                flag = false;
                ProjectData.ClearProjectError();
                return flag;
                ProjectData.ClearProjectError();
            }
            return flag;
        }

        public void ClearTemp(string strKhoa)
        {
            string commandText = "";
            commandText = " DELETE FROM SC_NoiDungKiemTraLoiThietBiTmp WHERE KhoaTiepNhan = '" + strKhoa + "'";
            DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]);
            commandText = " DELETE FROM SC_DeXuatSuaChuaTmp WHERE KhoaTiepNhan = '" + strKhoa + "'";
            DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]);
        }

        public bool DelData(string strKhoa)
        {
            bool flag=false;
            try
            {
                string commandText = "";
                commandText = "DELETE FROM SC_TiepNhanThietBi WHERE Khoa = '" + strKhoa + "'";
                DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]);
                flag = true;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                flag = false;
                ProjectData.ClearProjectError();
                return flag;
                ProjectData.ClearProjectError();
            }
            return flag;
        }

        public DataTable GetDataPrintBienBan(string strKhoa)
        {
            DataTable table;
            IDataParameter[] commandParameters = new IDataParameter[2];
            try
            {
                commandParameters[0] = DBHelper.createParameter("@KhoaTiepNhan", DbType.Int64, ParameterDirection.Input, strKhoa);
                commandParameters[1] = DBHelper.createParameter("@Language", DbType.Double, ParameterDirection.Input, modGeneral.H_LANGUAGE);
                table = DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.StoredProcedure, "SC_BC_BienBanSuaChua", commandParameters).Tables[0];
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                table = null;
                ProjectData.ClearProjectError();
                return table;
                ProjectData.ClearProjectError();
            }
            return table;
        }

        public DataTable GetDataPrintDeXuat(string strKhoa)
        {
            string commandText = "";
            commandText = "SELECT DX.NoiDung, IsNull(HH.Ma,'') As MaHang, DX.NguonHang, DX.SoSerial, DX.SoLuong, DX.DonGia, DX.ThanhTien, DX.DienGiai  FROM SC_DeXuatSuaChua DX LEFT JOIN DM_HangHoa HH ON DX.KhoaHangHoa = HH.Khoa  WHERE DX.KhoaTiepNhan = '" + strKhoa + "'";
            return DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]).Tables[0];
        }

        public DataTable GetDetailsDeXuat(string strKhoa = "")
        {
            string commandText = "";
            commandText = "SELECT CT.Khoa, CT.Loai, CT.NoiDung, CT.KhoaHangHoa, HH.Ma As MaHang, CT.NguonHang, CT.SoSerial, CT.DienGiai, CT.KhoaDonViTinh,  CT.SoLuong, CT.DonGia, CT.ThanhTien  FROM SC_DeXuatSuaChua CT LEFT JOIN DM_HangHoa HH ON CT.KhoaHangHoa = HH.Khoa WHERE CT.KhoaTiepNhan = '" + strKhoa + "' ORDER BY CT.Khoa";
            return DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]).Tables[0];
        }

        public DataTable GetDetailsKiemTra(string strKhoa = "")
        {
            string commandText = "";
            commandText = "SELECT CT.Khoa, HM.Khoa As KhoaHangMuc, HM.Ten" + modGeneral.H_LANGUAGE + " As TenHangMuc,  IsNull(CT.TinhTrang,0) As TinhTrang, CT.DienGiai  FROM DM_HangMucSuaChua HM LEFT JOIN SC_NoiDungKiemTraLoiThietBi CT ON HM.Khoa = CT.KhoaHangMuc And CT.KhoaTiepNhan = '" + strKhoa + "'";
            return DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]).Tables[0];
        }

        public DataTable GetListTiepNhan(string strConditions)
        {
            string commandText = "";
            string str2 = "";
            if (strConditions.Trim() != "")
            {
                str2 = " And " + strConditions;
            }
            commandText = "SELECT TN.Khoa, TN.SoChungTu, dbo.Char2Date(TN.NgayChungTu) As NgayChungTu, HH.Ma As MaThietBi, HH.Ten" + modGeneral.H_LANGUAGE + " As TenThietBi, TN.SoSerial, KH.Ten" + modGeneral.H_LANGUAGE + " As TenKhachHang, TN.TinhTrangThietBi  FROM SC_TiepNhanThietBi TN LEFT JOIN DM_HangHoa HH ON TN.KhoaHangHoa = HH.Khoa  LEFT JOIN DM_DoiTuong KH ON TN.KhoaDoiTuong = KH.Khoa  WHERE 1 = 1 " + str2;
            return DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]).Tables[0];
        }

        public DataTable GetSoSuaChua(string strCondition = "")
        {
            string commandText = "";
            string str2 = "";
            if (strCondition.Trim() != "")
            {
                str2 = " WHERE 1 = 1 " + strCondition;
            }
            commandText = " SELECT TN.Khoa, TN.SoChungTu, dbo.Char2Date(TN.NgayChungTu) As Ngay, HH.Ma as MaThietBi, HH.TenViet As TenThietBi, TN.SoSerial, KH.TenViet As KhachHang,  TN.TinhTrangThietBi as TinhTrangBanDau, TN.LoaiSuaChua,  TN.XacDinhLoi, TN.NguyenNhan, TN.DienGiai As ThongTinXuLy, dbo.Char2Date(TN.NgayTraHang) As NgayTraHang, TN.TrangThai FROM SC_tiepNhanThietBi TN  LEFT JOIN DM_HangHoa HH ON TN.KhoaHangHoa = HH.Khoa  LEFT JOIN DM_DoiTuong KH ON TN.KhoaDoiTuong = KH.Khoa " + str2;
            return DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]).Tables[0];
        }

        public bool IsDuplicateVoucherNo(string strVoucherNo, string strKeyTable)
        {
            string commandText = "SELECT * FROM SC_TiepNhanThietBi Where Rtrim(SoChungTu) = '" + strVoucherNo.Trim() + "' AND Khoa <> '" + strKeyTable + "'";
            return (DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]).Tables[0].Rows.Count > 0);
        }

        public bool KiemTraThietBi(string strTask)
        {
            bool flag=false;
            IDataParameter[] commandParameters = new IDataParameter[13];
            try
            {
                commandParameters[0] = DBHelper.createParameter("@Khoa", DbType.Int64, ParameterDirection.Input, this.mKhoa);
                commandParameters[1] = DBHelper.createParameter("@NgayKiemTra", DbType.Int64, ParameterDirection.Input, this.mNgayKiemTra);
                commandParameters[2] = DBHelper.createParameter("@KhoaNhanVienKiemTra", DbType.Int64, ParameterDirection.Input, this.mKhoaNhanVienKiemTra);
                commandParameters[3] = DBHelper.createParameter("@XacDinhLoi", DbType.Int64, ParameterDirection.Input, this.mXacDinhLoi);
                commandParameters[4] = DBHelper.createParameter("@NguyenNhan", DbType.Int64, ParameterDirection.Input, this.mNguyenNhan);
                commandParameters[5] = DBHelper.createParameter("@LoaiSuaChua", DbType.Double, ParameterDirection.Input, this.mLoaiSuaChua);
                commandParameters[6] = DBHelper.createParameter("@LoaiTien", DbType.Int64, ParameterDirection.Input, this.mLoaiTien);
                commandParameters[7] = DBHelper.createParameter("@TyGia", DbType.Date, ParameterDirection.Input, this.mTyGia);
                commandParameters[8] = DBHelper.createParameter("@TriGiaThietBiThayThe", DbType.Date, ParameterDirection.Input, this.mTriGiaThietBiThayThe);
                commandParameters[9] = DBHelper.createParameter("@TriGiaNhanCong", DbType.Date, ParameterDirection.Input, this.mTriGiaNhanCong);
                commandParameters[10] = DBHelper.createParameter("@DienGiai", DbType.Int64, ParameterDirection.Input, this.mDienGiai);
                commandParameters[11] = DBHelper.createParameter("@Task", DbType.Int64, ParameterDirection.Input, strTask);
                commandParameters[12] = DBHelper.createParameter("@pError", DbType.Double, ParameterDirection.Output, 0);
                int num = DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.StoredProcedure, "SC_sp_KiemTraThietBi", commandParameters);
                if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(commandParameters[12].Value, 0, false))
                {
                    return true;
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                flag = false;
                ProjectData.ClearProjectError();
                return flag;
                ProjectData.ClearProjectError();
            }
            return flag;
        }

        public bool Load(string pKhoa)
        {
            bool flag=false;
            try
            {
                string commandText = "SELECT * FROM SC_TiepNhanThietBi WHERE Khoa = '" + pKhoa + "'";
                IDataReader dataReader = DBHelper.ExecuteReader(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]);
                if (dataReader.Read())
                {
                    this.mKhoa = Conversions.ToString(modGeneral.GetValue(dataReader, 0, modGeneral.typeOfColumn.GetString));
                    this.mSoChungTu = Conversions.ToString(modGeneral.GetValue(dataReader, 1, modGeneral.typeOfColumn.GetString));
                    this.mNgayChungTu = Conversions.ToString(modGeneral.GetValue(dataReader, 2, modGeneral.typeOfColumn.GetString));
                    this.mKhoaHangHoa = Conversions.ToString(modGeneral.GetValue(dataReader, 3, modGeneral.typeOfColumn.GetString));
                    this.mSoSerial = Conversions.ToString(modGeneral.GetValue(dataReader, 4, modGeneral.typeOfColumn.GetString));
                    this.mKhoaPhieuXuat = Conversions.ToString(modGeneral.GetValue(dataReader, 5, modGeneral.typeOfColumn.GetString));
                    this.mSoPhieuXuat = Conversions.ToString(modGeneral.GetValue(dataReader, 6, modGeneral.typeOfColumn.GetString));
                    this.mNgayBan = Conversions.ToString(modGeneral.GetValue(dataReader, 7, modGeneral.typeOfColumn.GetString));
                    this.mNgayTiepNhan = Conversions.ToString(modGeneral.GetValue(dataReader, 8, modGeneral.typeOfColumn.GetString));
                    this.mGioTiepNhan = Conversions.ToString(modGeneral.GetValue(dataReader, 9, modGeneral.typeOfColumn.GetString));
                    this.mKhoaDoiTuong = Conversions.ToString(modGeneral.GetValue(dataReader, 10, modGeneral.typeOfColumn.GetString));
                    this.mNguoiLienHe = Conversions.ToString(modGeneral.GetValue(dataReader, 11, modGeneral.typeOfColumn.GetString));
                    this.mDienThoaiLienHe = Conversions.ToString(modGeneral.GetValue(dataReader, 12, modGeneral.typeOfColumn.GetString));
                    this.mFaxLienHe = Conversions.ToString(modGeneral.GetValue(dataReader, 13, modGeneral.typeOfColumn.GetString));
                    this.mDienThoaiDiDong = Conversions.ToString(modGeneral.GetValue(dataReader, 14, modGeneral.typeOfColumn.GetString));
                    this.mThoiHanBaoHanh = Conversions.ToString(modGeneral.GetValue(dataReader, 15, modGeneral.typeOfColumn.GetString));
                    this.mConHanBaoHanh = Conversions.ToInteger(modGeneral.GetValue(dataReader, 0x10, modGeneral.typeOfColumn.GetInt32));
                    this.mTinhTrangThietBi = Conversions.ToString(modGeneral.GetValue(dataReader, 0x11, modGeneral.typeOfColumn.GetString));
                    this.mKhoaNhanVienTiepNhan = Conversions.ToString(modGeneral.GetValue(dataReader, 0x12, modGeneral.typeOfColumn.GetString));
                    this.mKhoaNhanVienBanHang = Conversions.ToString(modGeneral.GetValue(dataReader, 0x13, modGeneral.typeOfColumn.GetString));
                    this.mTrangThai = Conversions.ToInteger(modGeneral.GetValue(dataReader, 20, modGeneral.typeOfColumn.GetInt32));
                    this.mNgayKiemTra = Conversions.ToString(modGeneral.GetValue(dataReader, 0x15, modGeneral.typeOfColumn.GetString));
                    this.mKhoaNhanVienKiemTra = Conversions.ToString(modGeneral.GetValue(dataReader, 0x16, modGeneral.typeOfColumn.GetString));
                    this.mXacDinhLoi = Conversions.ToString(modGeneral.GetValue(dataReader, 0x17, modGeneral.typeOfColumn.GetString));
                    this.mNguyenNhan = Conversions.ToString(modGeneral.GetValue(dataReader, 0x18, modGeneral.typeOfColumn.GetString));
                    this.mLoaiSuaChua = Conversions.ToInteger(modGeneral.GetValue(dataReader, 0x19, modGeneral.typeOfColumn.GetInt32));
                    this.mTinhTrangSuaChua = Conversions.ToInteger(modGeneral.GetValue(dataReader, 0x1a, modGeneral.typeOfColumn.GetInt32));
                    this.mNgayHoanTatSuaChua = Conversions.ToString(modGeneral.GetValue(dataReader, 0x1b, modGeneral.typeOfColumn.GetString));
                    this.mTinhTrangSauKhiSuaChua = Conversions.ToString(modGeneral.GetValue(dataReader, 0x1c, modGeneral.typeOfColumn.GetString));
                    this.mLoaiTien = Conversions.ToString(modGeneral.GetValue(dataReader, 0x1d, modGeneral.typeOfColumn.GetString));
                    this.mTyGia = Conversions.ToDouble(modGeneral.GetValue(dataReader, 30, modGeneral.typeOfColumn.GetDecimal));
                    this.mTriGiaThietBiThayThe = Conversions.ToDouble(modGeneral.GetValue(dataReader, 0x1f, modGeneral.typeOfColumn.GetDecimal));
                    this.mTriGiaNhanCong = Conversions.ToDouble(modGeneral.GetValue(dataReader, 0x20, modGeneral.typeOfColumn.GetDecimal));
                    this.mNgayBanGiaoSales = Conversions.ToString(modGeneral.GetValue(dataReader, 0x21, modGeneral.typeOfColumn.GetString));
                    this.mNgayTraHang = Conversions.ToString(modGeneral.GetValue(dataReader, 0x22, modGeneral.typeOfColumn.GetString));
                    this.mGioTraHang = Conversions.ToString(modGeneral.GetValue(dataReader, 0x23, modGeneral.typeOfColumn.GetString));
                    this.mDienGiaiTraHang = Conversions.ToString(modGeneral.GetValue(dataReader, 0x24, modGeneral.typeOfColumn.GetString));
                    this.mDienGiai = Conversions.ToString(modGeneral.GetValue(dataReader, 0x25, modGeneral.typeOfColumn.GetString));
                }
                dataReader.Close();
                flag = true;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                flag = false;
                ProjectData.ClearProjectError();
                return flag;
                ProjectData.ClearProjectError();
            }
            return flag;
        }

        public bool Save()
        {
            bool flag=false;
            IDataParameter[] commandParameters = new IDataParameter[0x27];
            try
            {
                commandParameters[0] = DBHelper.createParameter("@Khoa", DbType.Int64, ParameterDirection.Input, this.mKhoa);
                commandParameters[1] = DBHelper.createParameter("@SoChungTu", DbType.Int64, ParameterDirection.Input, this.mSoChungTu);
                commandParameters[2] = DBHelper.createParameter("@NgayChungTu", DbType.Int64, ParameterDirection.Input, this.mNgayChungTu);
                commandParameters[3] = DBHelper.createParameter("@KhoaHangHoa", DbType.Int64, ParameterDirection.Input, this.mKhoaHangHoa);
                commandParameters[4] = DBHelper.createParameter("@SoSerial", DbType.Int64, ParameterDirection.Input, this.mSoSerial);
                commandParameters[5] = DBHelper.createParameter("@KhoaPhieuXuat", DbType.Int64, ParameterDirection.Input, this.mKhoaPhieuXuat);
                commandParameters[6] = DBHelper.createParameter("@SoPhieuXuat", DbType.Int64, ParameterDirection.Input, this.mSoPhieuXuat);
                commandParameters[7] = DBHelper.createParameter("@NgayBan", DbType.Int64, ParameterDirection.Input, this.mNgayBan);
                commandParameters[8] = DBHelper.createParameter("@NgayTiepNhan", DbType.Int64, ParameterDirection.Input, this.mNgayTiepNhan);
                commandParameters[9] = DBHelper.createParameter("@GioTiepNhan", DbType.Int64, ParameterDirection.Input, this.mGioTiepNhan);
                commandParameters[10] = DBHelper.createParameter("@KhoaDoiTuong", DbType.Int64, ParameterDirection.Input, this.mKhoaDoiTuong);
                commandParameters[11] = DBHelper.createParameter("@NguoiLienHe", DbType.Int64, ParameterDirection.Input, this.mNguoiLienHe);
                commandParameters[12] = DBHelper.createParameter("@DienThoaiLienHe", DbType.Int64, ParameterDirection.Input, this.mDienThoaiLienHe);
                commandParameters[13] = DBHelper.createParameter("@FaxLienHe", DbType.Int64, ParameterDirection.Input, this.mFaxLienHe);
                commandParameters[14] = DBHelper.createParameter("@DienThoaiDiDong", DbType.Int64, ParameterDirection.Input, this.mDienThoaiDiDong);
                commandParameters[15] = DBHelper.createParameter("@ThoiHanBaoHanh", DbType.Int64, ParameterDirection.Input, this.mThoiHanBaoHanh);
                commandParameters[0x10] = DBHelper.createParameter("@ConHanBaoHanh", DbType.Double, ParameterDirection.Input, this.mConHanBaoHanh);
                commandParameters[0x11] = DBHelper.createParameter("@TinhTrangThietBi", DbType.Int64, ParameterDirection.Input, this.mTinhTrangThietBi);
                commandParameters[0x12] = DBHelper.createParameter("@KhoaNhanVienTiepNhan", DbType.Int64, ParameterDirection.Input, this.mKhoaNhanVienTiepNhan);
                commandParameters[0x13] = DBHelper.createParameter("@KhoaNhanVienBanHang", DbType.Int64, ParameterDirection.Input, this.mKhoaNhanVienBanHang);
                commandParameters[20] = DBHelper.createParameter("@TrangThai", DbType.Double, ParameterDirection.Input, this.mTrangThai);
                commandParameters[0x15] = DBHelper.createParameter("@NgayKiemTra", DbType.Int64, ParameterDirection.Input, this.mNgayKiemTra);
                commandParameters[0x16] = DBHelper.createParameter("@KhoaNhanVienKiemTra", DbType.Int64, ParameterDirection.Input, this.mKhoaNhanVienKiemTra);
                commandParameters[0x17] = DBHelper.createParameter("@XacDinhLoi", DbType.Int64, ParameterDirection.Input, this.mXacDinhLoi);
                commandParameters[0x18] = DBHelper.createParameter("@NguyenNhan", DbType.Int64, ParameterDirection.Input, this.mNguyenNhan);
                commandParameters[0x19] = DBHelper.createParameter("@LoaiSuaChua", DbType.Double, ParameterDirection.Input, this.mLoaiSuaChua);
                commandParameters[0x1a] = DBHelper.createParameter("@TinhTrangSuaChua", DbType.Double, ParameterDirection.Input, this.mTinhTrangSuaChua);
                commandParameters[0x1b] = DBHelper.createParameter("@NgayHoanTatSuaChua", DbType.Int64, ParameterDirection.Input, this.mNgayHoanTatSuaChua);
                commandParameters[0x1c] = DBHelper.createParameter("@TinhTrangSauKhiSuaChua", DbType.Int64, ParameterDirection.Input, this.mTinhTrangSauKhiSuaChua);
                commandParameters[0x1d] = DBHelper.createParameter("@LoaiTien", DbType.Int64, ParameterDirection.Input, this.mLoaiTien);
                commandParameters[30] = DBHelper.createParameter("@TyGia", DbType.Date, ParameterDirection.Input, this.mTyGia);
                commandParameters[0x1f] = DBHelper.createParameter("@TriGiaThietBiThayThe", DbType.Date, ParameterDirection.Input, this.mTriGiaThietBiThayThe);
                commandParameters[0x20] = DBHelper.createParameter("@TriGiaNhanCong", DbType.Date, ParameterDirection.Input, this.mTriGiaNhanCong);
                commandParameters[0x21] = DBHelper.createParameter("@NgayBanGiaoSales", DbType.Int64, ParameterDirection.Input, this.mNgayBanGiaoSales);
                commandParameters[0x22] = DBHelper.createParameter("@NgayTraHang", DbType.Int64, ParameterDirection.Input, this.mNgayTraHang);
                commandParameters[0x23] = DBHelper.createParameter("@GioTraHang", DbType.Int64, ParameterDirection.Input, this.mGioTraHang);
                commandParameters[0x24] = DBHelper.createParameter("@DienGiaiTraHang", DbType.Int64, ParameterDirection.Input, this.mDienGiaiTraHang);
                commandParameters[0x25] = DBHelper.createParameter("@DienGiai", DbType.Int64, ParameterDirection.Input, this.mDienGiai);
                commandParameters[0x26] = DBHelper.createParameter("@pError", DbType.Double, ParameterDirection.Output, 0);
                int num = DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.StoredProcedure, "SC_sp_TiepNhanThietBi", commandParameters);
                if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(commandParameters[0x26].Value, 0, false))
                {
                    return true;
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                flag = false;
                ProjectData.ClearProjectError();
                return flag;
                ProjectData.ClearProjectError();
            }
            return flag;
        }

        public int ConHanBaoHanh
        {
            get
            {
                return this.mConHanBaoHanh;
            }
            set
            {
                this.mConHanBaoHanh = value;
            }
        }

        public string DienGiai
        {
            get
            {
                return this.mDienGiai;
            }
            set
            {
                this.mDienGiai = value;
            }
        }

        public string DienGiaiTraHang
        {
            get
            {
                return this.mDienGiaiTraHang;
            }
            set
            {
                this.mDienGiaiTraHang = value;
            }
        }

        public string DienThoaiDiDong
        {
            get
            {
                return this.mDienThoaiDiDong;
            }
            set
            {
                this.mDienThoaiDiDong = value;
            }
        }

        public string DienThoaiLienHe
        {
            get
            {
                return this.mDienThoaiLienHe;
            }
            set
            {
                this.mDienThoaiLienHe = value;
            }
        }

        public string FaxLienHe
        {
            get
            {
                return this.mFaxLienHe;
            }
            set
            {
                this.mFaxLienHe = value;
            }
        }

        public string GioTiepNhan
        {
            get
            {
                return this.mGioTiepNhan;
            }
            set
            {
                this.mGioTiepNhan = value;
            }
        }

        public string GioTraHang
        {
            get
            {
                return this.mGioTraHang;
            }
            set
            {
                this.mGioTraHang = value;
            }
        }

        public string Khoa
        {
            get
            {
                return this.mKhoa;
            }
            set
            {
                this.mKhoa = value;
            }
        }

        public string KhoaDoiTuong
        {
            get
            {
                return this.mKhoaDoiTuong;
            }
            set
            {
                this.mKhoaDoiTuong = value;
            }
        }

        public string KhoaHangHoa
        {
            get
            {
                return this.mKhoaHangHoa;
            }
            set
            {
                this.mKhoaHangHoa = value;
            }
        }

        public string KhoaNhanVienBanHang
        {
            get
            {
                return this.mKhoaNhanVienBanHang;
            }
            set
            {
                this.mKhoaNhanVienBanHang = value;
            }
        }

        public string KhoaNhanVienKiemTra
        {
            get
            {
                return this.mKhoaNhanVienKiemTra;
            }
            set
            {
                this.mKhoaNhanVienKiemTra = value;
            }
        }

        public string KhoaNhanVienTiepNhan
        {
            get
            {
                return this.mKhoaNhanVienTiepNhan;
            }
            set
            {
                this.mKhoaNhanVienTiepNhan = value;
            }
        }

        public string KhoaPhieuXuat
        {
            get
            {
                return this.mKhoaPhieuXuat;
            }
            set
            {
                this.mKhoaPhieuXuat = value;
            }
        }

        public int LoaiSuaChua
        {
            get
            {
                return this.mLoaiSuaChua;
            }
            set
            {
                this.mLoaiSuaChua = value;
            }
        }

        public string LoaiTien
        {
            get
            {
                return this.mLoaiTien;
            }
            set
            {
                this.mLoaiTien = value;
            }
        }

        public string NgayBan
        {
            get
            {
                return this.mNgayBan;
            }
            set
            {
                this.mNgayBan = value;
            }
        }

        public string NgayBanGiaoSales
        {
            get
            {
                return this.mNgayBanGiaoSales;
            }
            set
            {
                this.mNgayBanGiaoSales = value;
            }
        }

        public string NgayChungTu
        {
            get
            {
                return this.mNgayChungTu;
            }
            set
            {
                this.mNgayChungTu = value;
            }
        }

        public string NgayHoanTatSuaChua
        {
            get
            {
                return this.mNgayHoanTatSuaChua;
            }
            set
            {
                this.mNgayHoanTatSuaChua = value;
            }
        }

        public string NgayKiemTra
        {
            get
            {
                return this.mNgayKiemTra;
            }
            set
            {
                this.mNgayKiemTra = value;
            }
        }

        public string NgayTiepNhan
        {
            get
            {
                return this.mNgayTiepNhan;
            }
            set
            {
                this.mNgayTiepNhan = value;
            }
        }

        public string NgayTraHang
        {
            get
            {
                return this.mNgayTraHang;
            }
            set
            {
                this.mNgayTraHang = value;
            }
        }

        public string NguoiLienHe
        {
            get
            {
                return this.mNguoiLienHe;
            }
            set
            {
                this.mNguoiLienHe = value;
            }
        }

        public string NguyenNhan
        {
            get
            {
                return this.mNguyenNhan;
            }
            set
            {
                this.mNguyenNhan = value;
            }
        }

        public string SoChungTu
        {
            get
            {
                return this.mSoChungTu;
            }
            set
            {
                this.mSoChungTu = value;
            }
        }

        public string SoPhieuXuat
        {
            get
            {
                return this.mSoPhieuXuat;
            }
            set
            {
                this.mSoPhieuXuat = value;
            }
        }

        public string SoSerial
        {
            get
            {
                return this.mSoSerial;
            }
            set
            {
                this.mSoSerial = value;
            }
        }

        public string ThoiHanBaoHanh
        {
            get
            {
                return this.mThoiHanBaoHanh;
            }
            set
            {
                this.mThoiHanBaoHanh = value;
            }
        }

        public string TinhTrangSauKhiSuaChua
        {
            get
            {
                return this.mTinhTrangSauKhiSuaChua;
            }
            set
            {
                this.mTinhTrangSauKhiSuaChua = value;
            }
        }

        public int TinhTrangSuaChua
        {
            get
            {
                return this.mTinhTrangSuaChua;
            }
            set
            {
                this.mTinhTrangSuaChua = value;
            }
        }

        public string TinhTrangThietBi
        {
            get
            {
                return this.mTinhTrangThietBi;
            }
            set
            {
                this.mTinhTrangThietBi = value;
            }
        }

        public int TrangThai
        {
            get
            {
                return this.mTrangThai;
            }
            set
            {
                this.mTrangThai = value;
            }
        }

        public double TriGiaNhanCong
        {
            get
            {
                return this.mTriGiaNhanCong;
            }
            set
            {
                this.mTriGiaNhanCong = value;
            }
        }

        public double TriGiaThietBiThayThe
        {
            get
            {
                return this.mTriGiaThietBiThayThe;
            }
            set
            {
                this.mTriGiaThietBiThayThe = value;
            }
        }

        public double TyGia
        {
            get
            {
                return this.mTyGia;
            }
            set
            {
                this.mTyGia = value;
            }
        }

        public string XacDinhLoi
        {
            get
            {
                return this.mXacDinhLoi;
            }
            set
            {
                this.mXacDinhLoi = value;
            }
        }
    }
}

